From: Keir Fraser Date: Thu, 9 Oct 2008 10:08:13 +0000 (+0100) Subject: vt-d: Define a struct IO_xAPIC_route_entry to accommodate both ioapic X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14091^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=7ae8a1e482744619d6f4b93d67a044523099eae7;p=xen.git vt-d: Define a struct IO_xAPIC_route_entry to accommodate both ioapic and iosapic. Signed-off-by: Anthony Xu Signed-off-by: Dexuan Cui --- diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 2a2ba08d16..356e887ef8 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -44,7 +44,7 @@ u16 apicid_to_bdf(int apic_id) } static int remap_entry_to_ioapic_rte( - struct iommu *iommu, struct IO_APIC_route_entry *old_rte) + struct iommu *iommu, struct IO_xAPIC_route_entry *old_rte) { struct iremap_entry *iremap_entry = NULL, *iremap_entries; struct IO_APIC_route_remap_entry *remap_rte; @@ -90,13 +90,13 @@ static int remap_entry_to_ioapic_rte( } static int ioapic_rte_to_remap_entry(struct iommu *iommu, - int apic_id, struct IO_APIC_route_entry *old_rte, + int apic_id, struct IO_xAPIC_route_entry *old_rte, unsigned int rte_upper, unsigned int value) { struct iremap_entry *iremap_entry = NULL, *iremap_entries; struct iremap_entry new_ire; struct IO_APIC_route_remap_entry *remap_rte; - struct IO_APIC_route_entry new_rte; + struct IO_xAPIC_route_entry new_rte; int index; unsigned long flags; struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); @@ -177,7 +177,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu, unsigned int io_apic_read_remap_rte( unsigned int apic, unsigned int reg) { - struct IO_APIC_route_entry old_rte = { 0 }; + struct IO_xAPIC_route_entry old_rte = { 0 }; struct IO_APIC_route_remap_entry *remap_rte; int rte_upper = (reg & 1) ? 1 : 0; struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid); @@ -222,7 +222,7 @@ unsigned int io_apic_read_remap_rte( void io_apic_write_remap_rte( unsigned int apic, unsigned int reg, unsigned int value) { - struct IO_APIC_route_entry old_rte = { 0 }; + struct IO_xAPIC_route_entry old_rte = { 0 }; struct IO_APIC_route_remap_entry *remap_rte; unsigned int rte_upper = (reg & 1) ? 1 : 0; struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid); diff --git a/xen/drivers/passthrough/vtd/vtd.h b/xen/drivers/passthrough/vtd/vtd.h index d240ab7314..6aa8cf59cc 100644 --- a/xen/drivers/passthrough/vtd/vtd.h +++ b/xen/drivers/passthrough/vtd/vtd.h @@ -23,6 +23,43 @@ #include +/* Accomodate both IOAPIC and IOSAPIC. */ +struct IO_xAPIC_route_entry { + __u32 vector : 8, + delivery_mode : 3, /* 000: FIXED + * 001: lowest prio + * 111: ExtINT + */ + dest_mode : 1, /* 0: physical, 1: logical */ + delivery_status : 1, + polarity : 1, + irr : 1, + trigger : 1, /* 0: edge, 1: level */ + mask : 1, /* 0: enabled, 1: disabled */ + __reserved_2 : 15; + + union { + struct { __u32 + __reserved_1 : 24, + physical_dest : 4, + __reserved_2 : 4; + } physical; + + struct { __u32 + __reserved_1 : 24, + logical_dest : 8; + } logical; + +#ifdef __ia64__ + struct { __u32 + __reserved_1 : 16, + dest_id : 16; + }; +#endif + } dest; + +} __attribute__ ((packed)); + struct IO_APIC_route_remap_entry { union { u64 val;